<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>zjc-后台管理系统</title>
    <link rel="stylesheet" href="./vendor/simple-line-icons/css/simple-line-icons.css">
    <link rel="stylesheet" href="./vendor/font-awesome/css/fontawesome-all.min.css">
    <link rel="stylesheet" href="./css/styles.css">
</head>
<body class="sidebar-fixed header-fixed">
	<div class="page-wrapper">
	    <nav class="navbar page-header top-menu"></nav>
	    <div class="main-container">
	        <div class="sidebar left-menu"></div>
	        <div class="content">
	        	<div class="card" style="width: 50%;margin: auto;">
                    <div class="card-header bg-light">密码设置</div>

                    <div class="card-body">
		        		<div class="form-group">
		        			<div class="col-md-12">
								<div class="input-group">
									<div class="input-group-prepend"><span class="input-group-text">原密码：</span></div>
									<input type="text" id="oldPass"  class="form-control" placeholder="原密码">
								</div>
							</div>
		        		</div>
		        		<div class="form-group">
		        			<div class="col-md-12">
								<div class="input-group">
									<div class="input-group-prepend"><span class="input-group-text">新密码：</span></div>
									<input type="text" id="pass"  class="form-control" placeholder="新密码">
								</div>
							</div>
		        		</div>
		        		<div class="form-group">
		        			<div class="col-md-12">
								<div class="input-group">
									<div class="input-group-prepend"><span class="input-group-text">确认密码：</span></div>
									<input type="text" id="pass1"  class="form-control" placeholder="确认密码">
								</div>
							</div>
		        		</div>
		        		<div class="form-group">
		        			<div class="col-md-12">
								<button type="button" class="btn btn-primary form-control" onclick="updatePass()">确定提交</button>
							</div>
		        		</div>
	        		</div>
	        	</div>
	        </div>
	    </div>
	</div>
	<script src="./vendor/jquery/jquery.min.js"></script>
	<script src="./vendor/popper.js/popper.min.js"></script>
	<script src="./vendor/bootstrap/js/bootstrap.min.js"></script>
	<script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
	<script src="./js/config.js" ></script>
	<script src="js/publicMenu.js" ></script>
	<script>
		function updatePass(){
			var oldPass=$("#oldPass").val();
	    	var pass=$("#pass").val();
	    	var pass1=$("#pass1").val();
	    	if(oldPass.length<1){
	    		layer.msg("请输入原密码");
	    		return;
	    	}
	    	if(pass.length<1||pass1.length<1){
	    		layer.msg("密码不能为空");
	    		return;
	    	}
	    	if(pass!=pass1){
	    		layer.msg("2次密码不一致");
	    		return;
	    	}
			$.ajax({ 
		     type : "post", 
		     url : BSAE_PATH+"/admin/updatePass",
		     dataType : 'json',
		     xhrFields:{ withCredentials:true},
		     data : { 
		     	pass : pass,
		     	oldPass : oldPass
		     },
		     success : function(result) {
			    if (result.code==200 ) { 
			    	layer.msg("修改成功");
			    }else{ 
			       layer.msg(result.msg);
			    } 
		     } 
	    });
	    
}
	</script>
	</body>
</html>
